package com.sptpc.exam.service.impl;

import com.sptpc.exam.mapper.StudentMapper;
import com.sptpc.exam.model.Student;
import com.sptpc.exam.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements IStudentService {

    @Autowired
    private StudentMapper mapper;

    @Override
    public Student addNewStudent(Student stu) {
        int flag = mapper.insert(stu);
        if (flag > 0){
            return stu;
        } else {
            return null;
        }
    }

    @Override
    public List<Student> displayAll() {
        return null;
    }

    @Override
    public void deleteStudent(Long id) {
        mapper.deleteByPrimaryKey(id.longValue());
    }

    @Override
    public Student updateStudent(Student stu) {
        return null;
    }
}
